package com.turing.system.controller;

import com.alibaba.fastjson.JSONObject;
import com.turing.system.service.CustomerWithdrawalsService;
import org.springframework.web.bind.annotation.*;
import result.Result;

import javax.annotation.Resource;

/**
 * @author 孙国鹏
 */
@RestController
public class CustomerController {

    @Resource private CustomerWithdrawalsService customerWithdrawalsService;

    /**
     * 客户交易记录(手机)
     * @param state
     * @param type
     * @param pageNum
     * @param pageSize
     * @param infoType
     * @return
     */
    @GetMapping("withdrawal/cwList")
    public Result cwList(
            @RequestParam(value = "state", required = false) Integer state,
            @RequestParam(value = "type", required = false) Integer type,
            @RequestParam(value = "pageNum", required = false) Integer pageNum,
            @RequestParam(value = "pageSize", required = false) Integer pageSize,
            @RequestParam(value = "infoType", required = false) Integer infoType
    ){
        return customerWithdrawalsService.cwList(state,type,pageNum,pageSize,infoType);
    }

    /**
     * 增加客户流水(系统)
     * @param jsonObject
     * @return
     */
    @PostMapping("withdrawal/cwAddSave")
    public Result cwAddSave(@RequestBody JSONObject jsonObject){
        return customerWithdrawalsService.cwAddSave(jsonObject);
    }

    /**
     * 客户流水列表
     */
    @GetMapping("withdrawal/cwListForPc")
    public Result cwListForPc(
            @RequestParam(value = "sourceId", required = false) String sourceId,
            @RequestParam(value = "targetId", required = false) String targetId,
            @RequestParam(value = "pageNum", required = false) Integer pageNum,
            @RequestParam(value = "pageSize", required = false) Integer pageSize,
            @RequestParam(value = "cwInfo", required = false) String cwInfo
    ){
        return customerWithdrawalsService.cwListForPc(sourceId,targetId,pageNum,pageSize,cwInfo);
    }


}
